<!DOCTYPE HTML>
<html lang="zh-CN">
<head>
	<meta name="generator" content="Hugo 0.63.2" />
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /> 
    <title>天地维杰网 - 天地维杰网</title>
    <meta name="keywords" content="系统架构,shutdown,不与天斗,Domino,博客,程序员,架构师,笔记,技术,分享,java,Redis">
    
    <meta property="og:title" content="天地维杰网">
    <meta property="og:site_name" content="天地维杰网">
    <meta property="og:image" content="/img/author.jpg"> 
    <meta name="title" content="天地维杰网 - 天地维杰网" />
    <meta name="description" content="天地维杰网 | 博客 | 软件 | 架构 | Java "> 
    <link rel="shortcut icon" href="http://www.shutdown.cn/img/favicon.ico" />
    <link rel="apple-touch-icon" href="http://www.shutdown.cn/img/apple-touch-icon.png" />
    <link rel="apple-touch-icon-precomposed" href="http://www.shutdown.cn/img/apple-touch-icon.png" />
    <link href="http://www.shutdown.cn/js/vendor/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />
    
    <link href="http://www.shutdown.cn/css/main.css" rel="stylesheet" type="text/css" />
    <link href="http://www.shutdown.cn/css/syntax.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" id="hexo.configuration">
  var NexT = window.NexT || {};
  var CONFIG = {
    scheme: 'Pisces',
    sidebar: {"position":"left","display":"post"},
    fancybox: false, 
    motion: true
  };
</script>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-7826003325059020" crossorigin="anonymous"></script>
</head>
<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">
<div class="container one-collumn sidebar-position-left page-home  ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"> <div class="site-meta  custom-logo ">

  <div class="custom-logo-site-title">
    <a href="http://www.shutdown.cn"  class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <span class="site-title">天地维杰网</span>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>
  <p class="site-subtitle">人如秋鸿来有信，事若春梦了无痕</p>
</div>

<div class="site-nav-toggle">
  <button>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
  </button>
</div>

<nav class="site-nav">
    <ul id="menu" class="menu">
      
      
        <li class="menu-item menu-item-active">
          <a href="http://www.shutdown.cn/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />首页
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/categories/redis/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-battery-full"></i> <br />Redis
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/categories/java/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-coffee"></i> <br />java
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/categories/linux/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-linux"></i> <br />linux
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/categories/daily/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-bug"></i> <br />日常问题
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/categories/spring/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-child"></i> <br />Spring和Springboot
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/categories/mac/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-fire"></i> <br />Mac相关
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/categories/middleware/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-gavel"></i> <br />中间件
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/categories/jiagou/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-rocket"></i> <br />架构
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/categories/python/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-ship"></i> <br />python
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/categories/front/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-bolt"></i> <br />前端
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/categories/jvm/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-balance-scale"></i> <br />jvm
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/categories/c/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-battery-empty"></i> <br />c语言
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/categories/web3/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-web3"></i> <br />web3
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/post/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />归档
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/about/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />关于
          </a>
        </li>
      
      <li class="menu-item menu-item-search">
        <a href="javascript:;" class="popup-trigger"> <i class="menu-item-icon fa fa-search fa-fw"></i> <br /> 搜索</a>
      </li>
    </ul>
    <div class="site-search">
      <div class="popup">
 <span class="search-icon fa fa-search"></span>
 <input type="text" id="local-search-input">
 <div id="local-search-result"></div>
 <span class="popup-btn-close">close</span>
</div>

    </div>
</nav>

 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            
    
 <section id="posts" class="posts-expand">

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <header class="post-header">
      <h1 class="post-title" itemprop="name headline">
        <a class="post-title-link" href="http://www.shutdown.cn/post/redis5.0%E4%BC%98%E5%8C%96-%E5%86%85%E5%AD%98%E4%BD%BF%E7%94%A8%E7%BB%9F%E8%AE%A1%E6%8A%A5%E5%91%8A%E4%BC%98%E5%8C%96/" itemprop="url">
        
        </a>
      </h1>
      <div class="post-meta">
      <span class="post-time">
<span class="post-meta-item-icon">
    <i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">时间：</span>
<time itemprop="dateCreated" datetime="2016-03-22T13:04:35+08:00" content="0001-01-01">
    0001-01-01
</time>
</span> 
      
       <span>
&nbsp; | &nbsp;
<span class="post-meta-item-icon">
    <i class="fa fa-eye"></i>
</span>
<span class="post-meta-item-text">阅读：</span>
<span class="leancloud-visitors-count">318 字 ~2分钟</span>
</span>
      </div>
    </header>
    <div class="post-body" itemprop="articleBody">
    
    Redis5.0优化点中有内存使用统计报告的优化，下面分别在Redis4的版本和Redis5的版本中分别使用info memory命令来查看返回结果，进行对比。
 Redis4.0.14 INFO MEMORY结果
[root@redis-7-105 conf]# redis-cli -p 7008 info memory # Memory used_memory:14835120 used_memory_human:14.15M used_memory_rss:24780800 used_memory_rss_human:23.63M used_memory_peak:14884304 used_memory_peak_human:14.19M used_memory_peak_perc:99.67% used_memory_overhead:1941912 used_memory_startup:786640 used_memory_dataset:12893208 used_memory_dataset_perc:91.78% total_system_memory:1019572224 total_system_memory_human:972.34M used_memory_lua:37888 used_memory_lua_human:37.00K maxmemory:0 maxmemory_human:0B maxmemory_policy:noeviction mem_fragmentation_ratio:1.67 mem_allocator:jemalloc-4.0.3 active_defrag_running:0 lazyfree_pending_objects:0 ```` - **Redis5.0.9 INFO MEMORY结果** shell [root@reids-7-104 data]# redis-cli -p 7007 info memory
Memory used_memory:13771704 used_memory_human:13.13M used_memory_rss:27258880 used_memory_rss_human:26.00M used_memory_peak:13812512 used_memory_peak_human:13.17M used_memory_peak_perc:99.70% used_memory_overhead:882422 used_memory_startup:792456 used_memory_dataset:12889282 used_memory_dataset_perc:99.31% allocator_allocated:13982280 allocator_active:15417344 allocator_resident:24666112 total_system_memory:1019572224 total_system_memory_human:972.34M used_memory_lua:37888 used_memory_lua_human:37.00K used_memory_scripts:0 used_memory_scripts_human:0B number_of_cached_scripts:0 maxmemory:0 maxmemory_human:0B maxmemory_policy:noeviction allocator_frag_ratio:1.
    </div>
    
    <div class="post-more-link text-center">
    <a class="btn" href="http://www.shutdown.cn/post/redis5.0%E4%BC%98%E5%8C%96-%E5%86%85%E5%AD%98%E4%BD%BF%E7%94%A8%E7%BB%9F%E8%AE%A1%E6%8A%A5%E5%91%8A%E4%BC%98%E5%8C%96/" rel="contents">
      阅读全文 &raquo;
    </a>
    </div>
    
    <footer class="post-footer"><div class="post-eof"></div></footer>
  </article>

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <header class="post-header">
      <h1 class="post-title" itemprop="name headline">
        <a class="post-title-link" href="http://www.shutdown.cn/post/redis5.0%E6%96%B0%E7%89%B9%E6%80%A7-stream%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B/" itemprop="url">
        
        </a>
      </h1>
      <div class="post-meta">
      <span class="post-time">
<span class="post-meta-item-icon">
    <i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">时间：</span>
<time itemprop="dateCreated" datetime="2016-03-22T13:04:35+08:00" content="0001-01-01">
    0001-01-01
</time>
</span> 
      
       <span>
&nbsp; | &nbsp;
<span class="post-meta-item-icon">
    <i class="fa fa-eye"></i>
</span>
<span class="post-meta-item-text">阅读：</span>
<span class="leancloud-visitors-count">1706 字 ~9分钟</span>
</span>
      </div>
    </header>
    <div class="post-body" itemprop="articleBody">
    
    原文地址：https://juejin.cn/post/7028439051308892167
 一、背景 最近在看redis这方面的知识，发现在redis5中产生了一种新的数据类型Stream，它和kafka的设计有些类似，可以当作一个简单的消息队列来使用。
二、redis中Stream类型的特点  支持持久化。streams能持久化存储数据，不同于pub/sub机制和list 消息被消费后就会被删除，streams消费过的数据会被持久化的保存在历史中。 支持消息的多播、分组消费。 这一点跟 pub/sub有些类似。 支持消息的有序性，可以通过消息的ID来控制消息的排序。 支持消费者组。streams 允许同一消费组内的消费者竞争消息，并提供了一系列机制允许消费者查看自己的历史消费消息。并允许监控streams的消费者组信息，消费者组内消费者信息，也可以监控streams内消息的状态。  三、Stream的结构  解释： 1. 消费者组：Consumer Group,即使用XGROUP CREATE命令创建的，一个消费者组中可以存在多个消费者，这些消费者之间是竞争关系。 1. 同一条消息，只能被这个消费者组中的某个消费者获取。 2. 多个消费者之间是相互独立的，互不干扰。 2. 消费者： Consumer 消费消息。 3. last_delivered_id： 这个id保证了在同一个消费者组中，一个消息只能被一个消费者获取。每当消费者组的某个消费者读取到了这个消息后，这个last_delivered_id的值会往后移动一位，保证消费者不会读取到重复的消息。 4. pending_ids：记录了消费者读取到的消息id列表，但是这些消息可能还没有处理，如果认为某个消息处理，需要调用ack命令。这样就确保了某个消息一定会被执行一次。 5. 消息内容：是一个键值对的格式。 6. Stream 中 消息的 ID： 默认情况下，ID使用 * ，redis可以自动生成一个，格式为 时间戳-序列号，也可以自己指定，一般使用默认生成的即可，且后生成的id号要比之前生成的大。
四、Stream的命令 1、XADD 往Stream末尾添加消息 1、命令格式 xadd key [NOMKSTREAM] [MAXLEN|MINID [=|~] threshold [LIMIT count]] *|ID field value [field value ...] xadd命令解释  2、举例 xadd 命令 返回的是数据的id, xx-yy (xx指的是毫秒数,yy指的是在这个毫秒内的第几条消息)
    </div>
    
    <div class="post-more-link text-center">
    <a class="btn" href="http://www.shutdown.cn/post/redis5.0%E6%96%B0%E7%89%B9%E6%80%A7-stream%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B/" rel="contents">
      阅读全文 &raquo;
    </a>
    </div>
    
    <footer class="post-footer"><div class="post-eof"></div></footer>
  </article>

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <header class="post-header">
      <h1 class="post-title" itemprop="name headline">
        <a class="post-title-link" href="http://www.shutdown.cn/post/redis5.0%E6%96%B0%E7%89%B9%E6%80%A7-%E9%9B%86%E7%BE%A4%E7%AE%A1%E7%90%86%E5%99%A8%E5%88%B0redis-cli/" itemprop="url">
        
        </a>
      </h1>
      <div class="post-meta">
      <span class="post-time">
<span class="post-meta-item-icon">
    <i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">时间：</span>
<time itemprop="dateCreated" datetime="2016-03-22T13:04:35+08:00" content="0001-01-01">
    0001-01-01
</time>
</span> 
      
       <span>
&nbsp; | &nbsp;
<span class="post-meta-item-icon">
    <i class="fa fa-eye"></i>
</span>
<span class="post-meta-item-text">阅读：</span>
<span class="leancloud-visitors-count">175 字 ~1分钟</span>
</span>
      </div>
    </header>
    <div class="post-body" itemprop="articleBody">
    
    Redis-trib支持的操作：
# redis-trib.rb help Usage: redis-trib &lt;command&gt; &lt;options&gt; &lt;arguments ...&gt; create host1:port1 ... hostN:portN --replicas &lt;arg&gt; check host:port info host:port fix host:port --timeout &lt;arg&gt; reshard host:port --from &lt;arg&gt; --to &lt;arg&gt; --slots &lt;arg&gt; --yes --timeout &lt;arg&gt; --pipeline &lt;arg&gt; rebalance host:port --weight &lt;arg&gt; --auto-weights --use-empty-masters --timeout &lt;arg&gt; --simulate --pipeline &lt;arg&gt; --threshold &lt;arg&gt; add-node new_host:new_port existing_host:existing_port --slave --master-id &lt;arg&gt; del-node host:port node_id set-timeout host:port milliseconds call host:port command arg arg .. arg import host:port --from &lt;arg&gt; --copy --replace help (show this help) For check, fix, reshard, del-node, set-timeout you can specify the host and port of any working node in the cluster.
    </div>
    
    <div class="post-more-link text-center">
    <a class="btn" href="http://www.shutdown.cn/post/redis5.0%E6%96%B0%E7%89%B9%E6%80%A7-%E9%9B%86%E7%BE%A4%E7%AE%A1%E7%90%86%E5%99%A8%E5%88%B0redis-cli/" rel="contents">
      阅读全文 &raquo;
    </a>
    </div>
    
    <footer class="post-footer"><div class="post-eof"></div></footer>
  </article>

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <header class="post-header">
      <h1 class="post-title" itemprop="name headline">
        <a class="post-title-link" href="http://www.shutdown.cn/post/redis5.0%E7%89%88%E6%9C%AC%E4%BB%8B%E7%BB%8D/" itemprop="url">
        
        </a>
      </h1>
      <div class="post-meta">
      <span class="post-time">
<span class="post-meta-item-icon">
    <i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">时间：</span>
<time itemprop="dateCreated" datetime="2016-03-22T13:04:35+08:00" content="0001-01-01">
    0001-01-01
</time>
</span> 
      
       <span>
&nbsp; | &nbsp;
<span class="post-meta-item-icon">
    <i class="fa fa-eye"></i>
</span>
<span class="post-meta-item-text">阅读：</span>
<span class="leancloud-visitors-count">669 字 ~4分钟</span>
</span>
      </div>
    </header>
    <div class="post-body" itemprop="articleBody">
    
    Introduction to the Redis 5 release Redis 5 is a release focused on a few important features. While Redis 4 was very very focused on operations, Redis 5 changes are mostly user-facing, with the implementation of new data types and operations on top of existing types. The following are the major features of this release:
 Redis5是一个聚焦到几个重要改进的版本。Redis4是非常关注操作，Redis5改进是非常关注用户界面， 新增了新的数据类型的实现和现有数据类型的相关操作。
  The new Stream data type. https://redis.io/topics/streams-intro New Redis modules APIs: Timers, Cluster and Dictionary APIs.
    </div>
    
    <div class="post-more-link text-center">
    <a class="btn" href="http://www.shutdown.cn/post/redis5.0%E7%89%88%E6%9C%AC%E4%BB%8B%E7%BB%8D/" rel="contents">
      阅读全文 &raquo;
    </a>
    </div>
    
    <footer class="post-footer"><div class="post-eof"></div></footer>
  </article>

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <header class="post-header">
      <h1 class="post-title" itemprop="name headline">
        <a class="post-title-link" href="http://www.shutdown.cn/post/redis6.0-lettuce%E6%94%AF%E6%8C%81%E5%AE%A2%E6%88%B7%E7%AB%AF%E7%BC%93%E5%AD%98/" itemprop="url">
        
        </a>
      </h1>
      <div class="post-meta">
      <span class="post-time">
<span class="post-meta-item-icon">
    <i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">时间：</span>
<time itemprop="dateCreated" datetime="2016-03-22T13:04:35+08:00" content="0001-01-01">
    0001-01-01
</time>
</span> 
      
       <span>
&nbsp; | &nbsp;
<span class="post-meta-item-icon">
    <i class="fa fa-eye"></i>
</span>
<span class="post-meta-item-text">阅读：</span>
<span class="leancloud-visitors-count">307 字 ~2分钟</span>
</span>
      </div>
    </header>
    <div class="post-body" itemprop="articleBody">
    
    Lettuce 已支持 Redis6 客户端缓存 简介： 在 redis 6.0 版本中，已经默认支持了客户端缓存功能，Java 中主流的连接客户端 lettuce 在最新的快照版本 (6.0.0.BUILD-SNAPSHOT) 已经提供支持。 下边就通过代码来体验一下客户端缓存的神奇功能。
Redis 客户端缓存 缓存的解决方案一般有两种：
【L1】 内存缓存（如 Caffeine、Ehcache） —— 速度快，进程内可用，但重启缓存丢失，出现缓存雪崩的问题。
【L2】集中式缓存（如 Redis）—— 可同时为多节点提供服务，但高并发下，带宽成为瓶颈。
业内有很多开源框架来解决以上问题，既能有 L1 速度，并且拥有 L2 集群态。如下
J2Cache 两级缓存框架
hotkey 热点数据实时同步
在 redis 6.0 版本中，已经默认支持了客户端缓存功能，Java 中主流的连接客户端 lettuce 在最新的快照版本 (6.0.0.BUILD-SNAPSHOT) 已经提供支持。 下边就通过代码来体验一下客户端缓存的神奇功能。
Redis 6.0 安装 安装 redis 6,这里通过 Docker 安装命令如下
docker run --name redis6 -p 6379:6379 --restart=always -d redis:6.0.6 Jar 依赖 注意： 这里使用 lettuce 客户端，注意当前使用 6.0 的快照版本 ，需要在 pom 增加 lettuce 快照仓库
    </div>
    
    <div class="post-more-link text-center">
    <a class="btn" href="http://www.shutdown.cn/post/redis6.0-lettuce%E6%94%AF%E6%8C%81%E5%AE%A2%E6%88%B7%E7%AB%AF%E7%BC%93%E5%AD%98/" rel="contents">
      阅读全文 &raquo;
    </a>
    </div>
    
    <footer class="post-footer"><div class="post-eof"></div></footer>
  </article>

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <header class="post-header">
      <h1 class="post-title" itemprop="name headline">
        <a class="post-title-link" href="http://www.shutdown.cn/post/redis6.0-tls%E6%B5%8B%E8%AF%95/" itemprop="url">
        
        </a>
      </h1>
      <div class="post-meta">
      <span class="post-time">
<span class="post-meta-item-icon">
    <i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">时间：</span>
<time itemprop="dateCreated" datetime="2016-03-22T13:04:35+08:00" content="0001-01-01">
    0001-01-01
</time>
</span> 
      
       <span>
&nbsp; | &nbsp;
<span class="post-meta-item-icon">
    <i class="fa fa-eye"></i>
</span>
<span class="post-meta-item-text">阅读：</span>
<span class="leancloud-visitors-count">332 字 ~2分钟</span>
</span>
      </div>
    </header>
    <div class="post-body" itemprop="articleBody">
    
    背景 传输层安全性协议（英语：Transport Layer Security，缩写作TLS），及其前身安全套接层（Secure Sockets Layer，缩写作SSL）是一种安全协议，目的是为互联网通信提供安全及数据完整性保障。Redis6支持TLS，并且支持SSL。
1.目录设置 redis源码解压目录
/app/cachecloud/redis 测试环境：CENTOS7.3 redis版本：6.2.7
2.编译redis 要测试TLS，要在编译时选择编译TLS，跳转到redis源码解压目录，执行
make BUILD_TLS=yes 编译过程中出现如下错误：
ssl.c:45:25: 致命错误：openssl/ssl.h：没有那个文件或目录 #include &lt;openssl/ssl.h&gt;  这时要中断编译，先安装openssl
yum install openssl-devel 安装好 open-ssl后再次执行make BUILD_TLS=yes命令即可编译成功
3.生成测试证书 在源码目录执行生成证书脚本
[root@redis-7-109 ~]# cd /app/cachecloud/redis [root@redis-7-109 redis]# ./utils/gen-test-certs.sh Generating RSA private key, 4096 bit long modulus …… 生成后在tests/tls目录下可以看到生成的证书文件
[root@redis-7-109 tls]# ls -l /app/cachecloud/redis/tests/tls/ 总用量 44 -rw-r--r--. 1 root root 1879 7月 11 11:30 ca.crt -rw-r--r--. 1 root root 3243 7月 11 11:30 ca.
    </div>
    
    <div class="post-more-link text-center">
    <a class="btn" href="http://www.shutdown.cn/post/redis6.0-tls%E6%B5%8B%E8%AF%95/" rel="contents">
      阅读全文 &raquo;
    </a>
    </div>
    
    <footer class="post-footer"><div class="post-eof"></div></footer>
  </article>

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <header class="post-header">
      <h1 class="post-title" itemprop="name headline">
        <a class="post-title-link" href="http://www.shutdown.cn/post/redis6.0%E6%96%B0%E7%89%B9%E6%80%A7-acls%E6%9D%83%E9%99%90%E6%8E%A7%E5%88%B6/" itemprop="url">
        
        </a>
      </h1>
      <div class="post-meta">
      <span class="post-time">
<span class="post-meta-item-icon">
    <i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">时间：</span>
<time itemprop="dateCreated" datetime="2016-03-22T13:04:35+08:00" content="0001-01-01">
    0001-01-01
</time>
</span> 
      
       <span>
&nbsp; | &nbsp;
<span class="post-meta-item-icon">
    <i class="fa fa-eye"></i>
</span>
<span class="post-meta-item-text">阅读：</span>
<span class="leancloud-visitors-count">814 字 ~4分钟</span>
</span>
      </div>
    </header>
    <div class="post-body" itemprop="articleBody">
    
    ACLs 权限控制  Redis 6开始支持ACL，该功能通过限制对命令和key的访问来提高安全性。ACL的工作方式是在连接之后，要求客户端进行身份验证（用户名和有效密码）；如果身份验证阶段成功，则连接与指定用户关联，并且该用户具有限制。 在默认配置中，Redis 6的工作方式与Redis的旧版本完全相同，每个新连接都能够调用每个可能的命令并访问每个键，因此ACL功能与旧版本向后兼容。客户和应用程序。依旧使用requirepass配置密码的，但现在只是为默认用户设置密码。
4.1 ACL使用 1) ACL &lt;subcommand&gt; arg arg ... arg. Subcommands are: 2) LOAD -- Reload users from the ACL file. 3) SAVE -- Save the current config to the ACL file. 4) LIST -- Show user details in config file format. 5) USERS -- List all the registered usernames. 6) SETUSER &lt;username&gt; [attribs ...] -- Create or modify a user. 7) GETUSER &lt;username&gt; -- Get the user details.
    </div>
    
    <div class="post-more-link text-center">
    <a class="btn" href="http://www.shutdown.cn/post/redis6.0%E6%96%B0%E7%89%B9%E6%80%A7-acls%E6%9D%83%E9%99%90%E6%8E%A7%E5%88%B6/" rel="contents">
      阅读全文 &raquo;
    </a>
    </div>
    
    <footer class="post-footer"><div class="post-eof"></div></footer>
  </article>

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <header class="post-header">
      <h1 class="post-title" itemprop="name headline">
        <a class="post-title-link" href="http://www.shutdown.cn/post/redis6.0%E6%96%B0%E7%89%B9%E6%80%A7-acl%E6%9D%83%E9%99%90%E6%8E%A7%E5%88%B6%E5%85%B6%E4%B8%80/" itemprop="url">
        
        </a>
      </h1>
      <div class="post-meta">
      <span class="post-time">
<span class="post-meta-item-icon">
    <i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">时间：</span>
<time itemprop="dateCreated" datetime="2016-03-22T13:04:35+08:00" content="0001-01-01">
    0001-01-01
</time>
</span> 
      
       <span>
&nbsp; | &nbsp;
<span class="post-meta-item-icon">
    <i class="fa fa-eye"></i>
</span>
<span class="post-meta-item-text">阅读：</span>
<span class="leancloud-visitors-count">5469 字 ~26分钟</span>
</span>
      </div>
    </header>
    <div class="post-body" itemprop="articleBody">
    
    官方文档地址：https://redis.io/docs/manual/security/acl/
 ACL Redis access control list
The Redis ACL, short for Access Control List, is the feature that allows certain connections to be limited in terms of the commands that can be executed and the keys that can be accessed. The way it works is that, after connecting, a client is required to provide a username and a valid password to authenticate. If authentication succeeded, the connection is associated with a given user and the limits the user has.
    </div>
    
    <div class="post-more-link text-center">
    <a class="btn" href="http://www.shutdown.cn/post/redis6.0%E6%96%B0%E7%89%B9%E6%80%A7-acl%E6%9D%83%E9%99%90%E6%8E%A7%E5%88%B6%E5%85%B6%E4%B8%80/" rel="contents">
      阅读全文 &raquo;
    </a>
    </div>
    
    <footer class="post-footer"><div class="post-eof"></div></footer>
  </article>

</section>
















<nav class="pagination">
    <a class="extend prev" rel="prev" href="http://www.shutdown.cn/p/15/"><i class="fa fa-angle-left"></i></a>
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
        
          <a class="page-number" href="http://www.shutdown.cn/p/12/">12</a>
        
        
    
        
        
          <a class="page-number" href="http://www.shutdown.cn/p/13/">13</a>
        
        
    
        
        
          <a class="page-number" href="http://www.shutdown.cn/p/14/">14</a>
        
        
    
        
        
          <a class="page-number" href="http://www.shutdown.cn/p/15/">15</a>
        
        
    
        
        
          <span class="page-number current">16</span>
        
        
    
        
        
          <a class="page-number" href="http://www.shutdown.cn/p/17/">17</a>
        
        
    
        
        
          <a class="page-number" href="http://www.shutdown.cn/p/18/">18</a>
        
        
    
        
        
          <a class="page-number" href="http://www.shutdown.cn/p/19/">19</a>
        
        
    
        
        
          <a class="page-number" href="http://www.shutdown.cn/p/20/">20</a>
        
        
    
        
    
        
    
        
    
    <a class="extend next" rel="next" href="http://www.shutdown.cn/p/17/"><i class="fa fa-angle-right"></i></a>
</nav>




          </div>
        </div>
        <div class="sidebar-toggle">
  <div class="sidebar-toggle-line-wrap">
    <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
    <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
    <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
  </div>
</div>
<aside id="sidebar" class="sidebar">
  <div class="sidebar-inner">

    <section class="site-overview sidebar-panel  sidebar-panel-active ">
      <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image"
        src="http://www.shutdown.cn/img/author.jpg"
        alt="不与天斗Domino" />
    <p class="site-author-name" itemprop="name">不与天斗Domino</p>
    <p class="site-description motion-element" itemprop="description"> 
        Programmer &amp; Architect</p>
</div>
      <nav class="site-state motion-element">
    <div class="site-state-item site-state-posts">
      <a href="http://www.shutdown.cn/post/">
        <span class="site-state-item-count">183</span>
        <span class="site-state-item-name">日志</span>
      </a>
    </div>
    <div class="site-state-item site-state-categories">    
        <a href="http://www.shutdown.cn/categories/">      
         
        <span class="site-state-item-count">15</span>
        
        <span class="site-state-item-name">分类</span>
        
        </a>
    </div>

    <div class="site-state-item site-state-tags">
        <a href="http://www.shutdown.cn/tags/">
         
        <span class="site-state-item-count">224</span>
        
        <span class="site-state-item-name">标签</span>
        </a>
    </div>
</nav>
      
<div class="feed-link motion-element">
<a href="http://www.shutdown.cn/index.xml" rel="alternate" type="application/rss+xml" target="_blank">
    <i class="fa fa-rss"></i>
    RSS 订阅
</a>
</div>

      

      

      <div class="links-of-blogroll motion-element inline">
<script type="text/javascript" src="//rf.revolvermaps.com/0/0/8.js?i=&amp;m=0&amp;s=220&amp;c=ff0000&amp;cr1=ffffff&amp;f=arial&amp;l=33&amp;bv=35" async="async"></script>
</div>

    </section>
    
  </div>
</aside>

      </div>
    </main>
   
    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  <span itemprop="copyrightYear">  &copy; 
  2013 - 2023</span>
  <span class="with-love"><i class="fa fa-heart"></i></span>
  <span class="author" itemprop="copyrightHolder">天地维杰网</span>
  <span class="icp" itemprop="copyrightHolder"><a href="https://beian.miit.gov.cn/" target="_blank">京ICP备13019191号-1</a></span>
</div>
<div class="powered-by">
  Powered by - <a class="theme-link" href="http://gohugo.io" target="_blank" title="hugo" >Hugo v0.63.2</a>
</div>
<div class="theme-info">
  Theme by - <a class="theme-link" href="https://github.com/xtfly/hugo-theme-next" target="_blank"> NexT
  </a>
</div>


      </div>
    </footer>

    <div class="back-to-top">
      <i class="fa fa-arrow-up"></i>
      <span id="scrollpercent"><span>0</span>%</span>
    </div>
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>
<script type="text/javascript" src="http://www.shutdown.cn/js/vendor/jquery/index.js?v=2.1.3"></script>
<script type="text/javascript" src="http://www.shutdown.cn/js/vendor/fastclick/lib/fastclick.min.js?v=1.0.6"></script> 
<script type="text/javascript" src="http://www.shutdown.cn/js/vendor/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
<script type="text/javascript" src="http://www.shutdown.cn/js/vendor/velocity/velocity.min.js?v=1.2.1"></script>
<script type="text/javascript" src="http://www.shutdown.cn/js/vendor/velocity/velocity.ui.min.js?v=1.2.1"></script>
<script src="http://www.shutdown.cn/js/vendor/ua-parser-js/dist/ua-parser.min.js?v=0.7.9"></script>

<script type="text/javascript" src="http://www.shutdown.cn/js/utils.js"></script>
<script type="text/javascript" src="http://www.shutdown.cn/js/motion.js"></script>
<script type="text/javascript" src="http://www.shutdown.cn/js/affix.js"></script>
<script type="text/javascript" src="http://www.shutdown.cn/js/schemes/pisces.js"></script>

<script type="text/javascript" src="http://www.shutdown.cn/js/bootstrap.js"></script>

<script type="text/javascript" id="motion.page.archive">
  $('.archive-year').velocity('transition.slideLeftIn');
</script>

<script type="text/javascript" src="http://www.shutdown.cn/js/search.js"></script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js"],
    jax: ["input/TeX", "output/HTML-CSS"],
    tex2jax: {
      inlineMath: [ ['$','$'] ],
      displayMath: [ ['$$','$$'] ],
      processEscapes: true
    },
    "HTML-CSS": { fonts: ["TeX"] }
  });
</script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML' async></script>
</body>
</html>